package cn.hnu.jpa.jpaExample.bidirectional;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.junit.Test;

public class UnitTest {

	//@Test
	public void test() {
		EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa");
		EntityManager em = emf.createEntityManager();
		em.getTransaction().begin();
		Student cpk = new Student();
		StuAddress id = new StuAddress();
		cpk.setName("zdc");
		id.setAddr("1111111111111");
		id.setPerson(cpk);
		cpk.setAddr(id);
		em.persist(id);
		em.getTransaction().commit();
		em.close();
		emf.close(); 
	}

}
